package com.cli.springboot_rabbitmq.provider;

import com.cli.springboot_rabbitmq.config.RabbitMQService;
import com.cli.springboot_rabbitmq.util.DataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Author xiongmin
 * @Description
 * @Date 2021/2/26 10:55
 * @Version 1.0
 **/
@Service
public class FanoutProviderService {

    @Autowired
    private RabbitMQService rabbitMQService;

    public String sendDirectMessage() {
        Map<String, Object> map = DataUtils.generateData();
        //将消息携带绑定键值：TestDirectRouting 发送到交换机TestDirectExchange
        rabbitMQService.messageDeliver("fanoutExchange",null, map);
        return "ok";
    }
}
